package mobileXversion1.diagram.part;

import java.util.Collections;
import java.util.List;

import org.eclipse.gef.Tool;
import org.eclipse.gef.palette.PaletteContainer;
import org.eclipse.gef.palette.PaletteDrawer;
import org.eclipse.gef.palette.PaletteGroup;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gef.palette.ToolEntry;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;

/**
 * @generated
 */
public class MobileXversion1PaletteFactory {

	/**
	 * @generated
	 */
	public void fillPalette(PaletteRoot paletteRoot) {
		paletteRoot.add(createPrototipoMobileX1Group());
	}

	/**
	 * Creates "Prototipo MobileX" palette tool group
	 * @generated
	 */
	private PaletteContainer createPrototipoMobileX1Group() {
		PaletteGroup paletteContainer = new PaletteGroup(
				mobileXversion1.diagram.part.Messages.PrototipoMobileX1Group_title);
		paletteContainer.setId("createPrototipoMobileX1Group"); //$NON-NLS-1$
		paletteContainer
				.setDescription(mobileXversion1.diagram.part.Messages.PrototipoMobileX1Group_desc);
		paletteContainer.add(createPrototipoMX1Group());
		paletteContainer.add(createRelacionesMobileX2Group());
		paletteContainer.add(createAppGeneralMobileX3Group());
		return paletteContainer;
	}

	/**
	 * Creates "PrototipoMX" palette tool group
	 * @generated
	 */
	private PaletteContainer createPrototipoMX1Group() {
		PaletteDrawer paletteContainer = new PaletteDrawer(
				mobileXversion1.diagram.part.Messages.PrototipoMX1Group_title);
		paletteContainer.setId("createPrototipoMX1Group"); //$NON-NLS-1$
		paletteContainer
				.setDescription(mobileXversion1.diagram.part.Messages.PrototipoMX1Group_desc);
		paletteContainer.add(createView1CreationTool());
		paletteContainer.add(createInput2CreationTool());
		paletteContainer.add(createImage3CreationTool());
		paletteContainer.add(createEvent4CreationTool());
		paletteContainer.add(createLabel5CreationTool());
		paletteContainer.add(createSetting6CreationTool());
		return paletteContainer;
	}

	/**
	 * Creates "Relaciones MobileX" palette tool group
	 * @generated
	 */
	private PaletteContainer createRelacionesMobileX2Group() {
		PaletteDrawer paletteContainer = new PaletteDrawer(
				mobileXversion1.diagram.part.Messages.RelacionesMobileX2Group_title);
		paletteContainer.setId("createRelacionesMobileX2Group"); //$NON-NLS-1$
		paletteContainer
				.setDescription(mobileXversion1.diagram.part.Messages.RelacionesMobileX2Group_desc);
		paletteContainer.add(createAppMobileMainView1CreationTool());
		paletteContainer.add(createAppMobileAppSetting2CreationTool());
		paletteContainer.add(createViewViewSetting3CreationTool());
		paletteContainer.add(createViewNextViews4CreationTool());
		paletteContainer.add(createViewViewEvents5CreationTool());
		paletteContainer.add(createComponentComponentEvents6CreationTool());
		return paletteContainer;
	}

	/**
	 * Creates "App General MobileX" palette tool group
	 * @generated
	 */
	private PaletteContainer createAppGeneralMobileX3Group() {
		PaletteDrawer paletteContainer = new PaletteDrawer(
				mobileXversion1.diagram.part.Messages.AppGeneralMobileX3Group_title);
		paletteContainer.setId("createAppGeneralMobileX3Group"); //$NON-NLS-1$
		paletteContainer
				.setDescription(mobileXversion1.diagram.part.Messages.AppGeneralMobileX3Group_desc);
		paletteContainer.add(createAppMobile1CreationTool());
		return paletteContainer;
	}

	/**
	 * @generated
	 */
	private ToolEntry createView1CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				mobileXversion1.diagram.part.Messages.View1CreationTool_title,
				mobileXversion1.diagram.part.Messages.View1CreationTool_desc,
				Collections
						.singletonList(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.View_2005));
		entry.setId("createView1CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(mobileXversion1.diagram.providers.MobileXversion1ElementTypes
				.getImageDescriptor(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.View_2005));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createInput2CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				mobileXversion1.diagram.part.Messages.Input2CreationTool_title,
				mobileXversion1.diagram.part.Messages.Input2CreationTool_desc,
				Collections
						.singletonList(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.Input_2003));
		entry.setId("createInput2CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(mobileXversion1.diagram.providers.MobileXversion1ElementTypes
				.getImageDescriptor(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.Input_2003));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createImage3CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				mobileXversion1.diagram.part.Messages.Image3CreationTool_title,
				mobileXversion1.diagram.part.Messages.Image3CreationTool_desc,
				Collections
						.singletonList(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.Image_2002));
		entry.setId("createImage3CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(mobileXversion1.diagram.providers.MobileXversion1ElementTypes
				.getImageDescriptor(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.Image_2002));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createEvent4CreationTool() {
		ToolEntry entry = new ToolEntry(
				mobileXversion1.diagram.part.Messages.Event4CreationTool_title,
				mobileXversion1.diagram.part.Messages.Event4CreationTool_desc,
				null, null) {
		};
		entry.setId("createEvent4CreationTool"); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createLabel5CreationTool() {
		ToolEntry entry = new ToolEntry(
				mobileXversion1.diagram.part.Messages.Label5CreationTool_title,
				mobileXversion1.diagram.part.Messages.Label5CreationTool_desc,
				null, null) {
		};
		entry.setId("createLabel5CreationTool"); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createSetting6CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				mobileXversion1.diagram.part.Messages.Setting6CreationTool_title,
				mobileXversion1.diagram.part.Messages.Setting6CreationTool_desc,
				Collections
						.singletonList(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.Setting_2004));
		entry.setId("createSetting6CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(mobileXversion1.diagram.providers.MobileXversion1ElementTypes
				.getImageDescriptor(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.Setting_2004));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createAppMobileMainView1CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				mobileXversion1.diagram.part.Messages.AppMobileMainView1CreationTool_title,
				mobileXversion1.diagram.part.Messages.AppMobileMainView1CreationTool_desc,
				Collections
						.singletonList(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.AppMobileMainView_4001));
		entry.setId("createAppMobileMainView1CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(mobileXversion1.diagram.providers.MobileXversion1ElementTypes
				.getImageDescriptor(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.AppMobileMainView_4001));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createAppMobileAppSetting2CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				mobileXversion1.diagram.part.Messages.AppMobileAppSetting2CreationTool_title,
				mobileXversion1.diagram.part.Messages.AppMobileAppSetting2CreationTool_desc,
				Collections
						.singletonList(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.AppMobileAppSetting_4004));
		entry.setId("createAppMobileAppSetting2CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(mobileXversion1.diagram.providers.MobileXversion1ElementTypes
				.getImageDescriptor(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.AppMobileAppSetting_4004));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createViewViewSetting3CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				mobileXversion1.diagram.part.Messages.ViewViewSetting3CreationTool_title,
				mobileXversion1.diagram.part.Messages.ViewViewSetting3CreationTool_desc,
				Collections
						.singletonList(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.ViewViewSetting_4002));
		entry.setId("createViewViewSetting3CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(mobileXversion1.diagram.providers.MobileXversion1ElementTypes
				.getImageDescriptor(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.ViewViewSetting_4002));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createViewNextViews4CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				mobileXversion1.diagram.part.Messages.ViewNextViews4CreationTool_title,
				mobileXversion1.diagram.part.Messages.ViewNextViews4CreationTool_desc,
				Collections
						.singletonList(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.ViewNextViews_4003));
		entry.setId("createViewNextViews4CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(mobileXversion1.diagram.providers.MobileXversion1ElementTypes
				.getImageDescriptor(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.ViewNextViews_4003));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createViewViewEvents5CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				mobileXversion1.diagram.part.Messages.ViewViewEvents5CreationTool_title,
				mobileXversion1.diagram.part.Messages.ViewViewEvents5CreationTool_desc,
				Collections
						.singletonList(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.ViewViewEvents_4006));
		entry.setId("createViewViewEvents5CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(mobileXversion1.diagram.providers.MobileXversion1ElementTypes
				.getImageDescriptor(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.ViewViewEvents_4006));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createComponentComponentEvents6CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				mobileXversion1.diagram.part.Messages.ComponentComponentEvents6CreationTool_title,
				mobileXversion1.diagram.part.Messages.ComponentComponentEvents6CreationTool_desc,
				Collections
						.singletonList(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.ComponentComponentEvents_4005));
		entry.setId("createComponentComponentEvents6CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(mobileXversion1.diagram.providers.MobileXversion1ElementTypes
				.getImageDescriptor(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.ComponentComponentEvents_4005));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createAppMobile1CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				mobileXversion1.diagram.part.Messages.AppMobile1CreationTool_title,
				mobileXversion1.diagram.part.Messages.AppMobile1CreationTool_desc,
				Collections
						.singletonList(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.AppMobile_2001));
		entry.setId("createAppMobile1CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(mobileXversion1.diagram.providers.MobileXversion1ElementTypes
				.getImageDescriptor(mobileXversion1.diagram.providers.MobileXversion1ElementTypes.AppMobile_2001));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private static class NodeToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List<IElementType> elementTypes;

		/**
		 * @generated
		 */
		private NodeToolEntry(String title, String description,
				List<IElementType> elementTypes) {
			super(title, description, null, null);
			this.elementTypes = elementTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}

	/**
	 * @generated
	 */
	private static class LinkToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List<IElementType> relationshipTypes;

		/**
		 * @generated
		 */
		private LinkToolEntry(String title, String description,
				List<IElementType> relationshipTypes) {
			super(title, description, null, null);
			this.relationshipTypes = relationshipTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}
}
